home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / ghostscript / src / gdevtiff.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  13KB  |  252 lines

  1. /*
  2.  * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
  3.  * Copyright (c) 1991, 1992 Silicon Graphics, Inc.
  4.  *
  5.  * Permission to use, copy, modify, distribute, and sell this software and 
  6.  * its documentation for any purpose is hereby granted without fee, provided
  7.  * that (i) the above copyright notices and this permission notice appear in
  8.  * all copies of the software and related documentation, and (ii) the names of
  9.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  10.  * publicity relating to the software without the specific, prior written
  11.  * permission of Sam Leffler and Silicon Graphics.
  12.  * 
  13.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  14.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  15.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  16.  * 
  17.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  18.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  19.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  21.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  22.  * OF THIS SOFTWARE.
  23.  */
  24.  
  25. #ifndef _TIFF_
  26. #define    _TIFF_
  27. /*
  28.  * Tag Image File Format (TIFF)
  29.  *
  30.  * Based on Rev 6.0 from:
  31.  *    Developer's Desk
  32.  *    Aldus Corporation
  33.  *    411 First Ave. South
  34.  *    Suite 200
  35.  *    Seattle, WA  98104
  36.  *    206-622-5500
  37.  */
  38. #define    TIFF_VERSION    42
  39.  
  40. #define    TIFF_BIGENDIAN        0x4d4d
  41. #define    TIFF_LITTLEENDIAN    0x4949
  42.  
  43. typedef    struct {
  44.     unsigned short tiff_magic;    /* magic number (defines byte order) */
  45.     unsigned short tiff_version;    /* TIFF version number */
  46.     unsigned long  tiff_diroff;    /* byte offset to first directory */
  47. } TIFFHeader;
  48.  
  49. /*
  50.  * TIFF Image File Directories are comprised of
  51.  * a table of field descriptors of the form shown
  52.  * below.  The table is sorted in ascending order
  53.  * by tag.  The values associated with each entry
  54.  * are disjoint and may appear anywhere in the file
  55.  * (so long as they are placed on a word boundary).
  56.  *
  57.  * If the value is 4 bytes or less, then it is placed
  58.  * in the offset field to save space.  If the value
  59.  * is less than 4 bytes, it is left-justified in the
  60.  * offset field.
  61.  */
  62. typedef    struct {
  63.     unsigned short tdir_tag;    /* see below */
  64.     unsigned short tdir_type;    /* data type; see below */
  65.     unsigned long  tdir_count;    /* number of items; length in spec */
  66.     unsigned long  tdir_offset;    /* byte offset to field data */
  67. } TIFFDirEntry;
  68.  
  69. /*
  70.  * NB: In the comments below,
  71.  *  - items marked with a + are obsoleted by revision 5.0,
  72.  *  - items marked with a ! are introduced in revision 6.0.
  73.  *  - items marked with a $ are obsoleted by revision 6.0.
  74.  */
  75.  
  76. /*
  77.  * Tag data type information.
  78.  *
  79.  * Note: RATIONALs are the ratio of two 32-bit integer values.
  80.  */
  81. typedef    enum {
  82.     TIFF_NOTYPE    = 0,    /* placeholder */
  83.     TIFF_BYTE    = 1,    /* 8-bit unsigned integer */
  84.     TIFF_ASCII    = 2,    /* 8-bit bytes w/ last byte null */
  85.     TIFF_SHORT    = 3,    /* 16-bit unsigned integer */
  86.     TIFF_LONG    = 4,    /* 32-bit unsigned integer */
  87.     TIFF_RATIONAL    = 5,    /* 64-bit unsigned fraction */
  88.     TIFF_SBYTE    = 6,    /* !8-bit signed integer */
  89.     TIFF_UNDEFINED    = 7,    /* !8-bit untyped data */
  90.     TIFF_SSHORT    = 8,    /* !16-bit signed integer */
  91.     TIFF_SLONG    = 9,    /* !32-bit signed integer */
  92.     TIFF_SRATIONAL    = 10,    /* !64-bit signed fraction */
  93.     TIFF_FLOAT    = 11,    /* !32-bit IEEE floating point */
  94.     TIFF_DOUBLE    = 12    /* !64-bit IEEE floating point */
  95. } TIFFDataType;
  96.  
  97. /*
  98.  * TIFF Tag Definitions.
  99.  */
  100. #define    TIFFTAG_SUBFILETYPE        254    /* subfile data descriptor */
  101. #define        FILETYPE_REDUCEDIMAGE    0x1    /* reduced resolution version */
  102. #define        FILETYPE_PAGE        0x2    /* one page of many */
  103. #define        FILETYPE_MASK        0x4    /* transparency mask */
  104. #define    TIFFTAG_OSUBFILETYPE        255    /* +kind of data in subfile */
  105. #define        OFILETYPE_IMAGE        1    /* full resolution image data */
  106. #define        OFILETYPE_REDUCEDIMAGE    2    /* reduced size image data */
  107. #define        OFILETYPE_PAGE        3    /* one page of many */
  108. #define    TIFFTAG_IMAGEWIDTH        256    /* image width in pixels */
  109. #define    TIFFTAG_IMAGELENGTH        257    /* image height in pixels */
  110. #define    TIFFTAG_BITSPERSAMPLE        258    /* bits per channel (sample) */
  111. #define    TIFFTAG_COMPRESSION        259    /* data compression technique */
  112. #define        COMPRESSION_NONE        1    /* dump mode */
  113. #define        COMPRESSION_CCITTRLE    2    /* CCITT modified Huffman RLE */
  114. #define        COMPRESSION_CCITTFAX3    3    /* CCITT Group 3 fax encoding */
  115. #define        COMPRESSION_CCITTFAX4    4    /* CCITT Group 4 fax encoding */
  116. #define        COMPRESSION_LZW        5    /* Lempel-Ziv  & Welch */
  117. #define        COMPRESSION_JPEG        6    /* !JPEG compression */
  118. #define        COMPRESSION_NEXT        32766    /* NeXT 2-bit RLE */
  119. #define        COMPRESSION_CCITTRLEW    32771    /* #1 w/ word alignment */
  120. #define        COMPRESSION_PACKBITS    32773    /* Macintosh RLE */
  121. #define        COMPRESSION_THUNDERSCAN    32809    /* ThunderScan RLE */
  122. #define    TIFFTAG_PHOTOMETRIC        262    /* photometric interpretation */
  123. #define        PHOTOMETRIC_MINISWHITE    0    /* min value is white */
  124. #define        PHOTOMETRIC_MINISBLACK    1    /* min value is black */
  125. #define        PHOTOMETRIC_RGB        2    /* RGB color model */
  126. #define        PHOTOMETRIC_PALETTE        3    /* color map indexed */
  127. #define        PHOTOMETRIC_MASK        4    /* $holdout mask */
  128. #define        PHOTOMETRIC_SEPARATED    5    /* !color separations */
  129. #define        PHOTOMETRIC_YCBCR        6    /* !CCIR 601 */
  130. #define        PHOTOMETRIC_CIELAB        8    /* !1976 CIE L*a*b* */
  131. #define    TIFFTAG_THRESHHOLDING        263    /* +thresholding used on data */
  132. #define        THRESHHOLD_BILEVEL        1    /* b&w art scan */
  133. #define        THRESHHOLD_HALFTONE        2    /* or dithered scan */
  134. #define        THRESHHOLD_ERRORDIFFUSE    3    /* usually floyd-steinberg */
  135. #define    TIFFTAG_CELLWIDTH        264    /* +dithering matrix width */
  136. #define    TIFFTAG_CELLLENGTH        265    /* +dithering matrix height */
  137. #define    TIFFTAG_FILLORDER        266    /* data order within a byte */
  138. #define        FILLORDER_MSB2LSB        1    /* most significant -> least */
  139. #define        FILLORDER_LSB2MSB        2    /* least significant -> most */
  140. #define    TIFFTAG_DOCUMENTNAME        269    /* name of doc. image is from */
  141. #define    TIFFTAG_IMAGEDESCRIPTION    270    /* info about image */
  142. #define    TIFFTAG_MAKE            271    /* scanner manufacturer name */
  143. #define    TIFFTAG_MODEL            272    /* scanner model name/number */
  144. #define    TIFFTAG_STRIPOFFSETS        273    /* offsets to data strips */
  145. #define    TIFFTAG_ORIENTATION        274    /* +image orientation */
  146. #define        ORIENTATION_TOPLEFT        1    /* row 0 top, col 0 lhs */
  147. #define        ORIENTATION_TOPRIGHT    2    /* row 0 top, col 0 rhs */
  148. #define        ORIENTATION_BOTRIGHT    3    /* row 0 bottom, col 0 rhs */
  149. #define        ORIENTATION_BOTLEFT        4    /* row 0 bottom, col 0 lhs */
  150. #define        ORIENTATION_LEFTTOP        5    /* row 0 lhs, col 0 top */
  151. #define        ORIENTATION_RIGHTTOP    6    /* row 0 rhs, col 0 top */
  152. #define        ORIENTATION_RIGHTBOT    7    /* row 0 rhs, col 0 bottom */
  153. #define        ORIENTATION_LEFTBOT        8    /* row 0 lhs, col 0 bottom */
  154. #define    TIFFTAG_SAMPLESPERPIXEL        277    /* samples per pixel */
  155. #define    TIFFTAG_ROWSPERSTRIP        278    /* rows per strip of data */
  156. #define    TIFFTAG_STRIPBYTECOUNTS        279    /* bytes counts for strips */
  157. #define    TIFFTAG_MINSAMPLEVALUE        280    /* +minimum sample value */
  158. #define    TIFFTAG_MAXSAMPLEVALUE        281    /* +maximum sample value */
  159. #define    TIFFTAG_XRESOLUTION        282    /* pixels/resolution in x */
  160. #define    TIFFTAG_YRESOLUTION        283    /* pixels/resolution in y */
  161. #define    TIFFTAG_PLANARCONFIG        284    /* storage organization */
  162. #define        PLANARCONFIG_CONTIG        1    /* single image plane */
  163. #define        PLANARCONFIG_SEPARATE    2    /* separate planes of data */
  164. #define    TIFFTAG_PAGENAME        285    /* page name image is from */
  165. #define    TIFFTAG_XPOSITION        286    /* x page offset of image lhs */
  166. #define    TIFFTAG_YPOSITION        287    /* y page offset of image lhs */
  167. #define    TIFFTAG_FREEOFFSETS        288    /* +byte offset to free block */
  168. #define    TIFFTAG_FREEBYTECOUNTS        289    /* +sizes of free blocks */
  169. #define    TIFFTAG_GRAYRESPONSEUNIT    290    /* $gray scale curve accuracy */
  170. #define        GRAYRESPONSEUNIT_10S    1    /* tenths of a unit */
  171. #define        GRAYRESPONSEUNIT_100S    2    /* hundredths of a unit */
  172. #define        GRAYRESPONSEUNIT_1000S    3    /* thousandths of a unit */
  173. #define        GRAYRESPONSEUNIT_10000S    4    /* ten-thousandths of a unit */
  174. #define        GRAYRESPONSEUNIT_100000S    5    /* hundred-thousandths */
  175. #define    TIFFTAG_GRAYRESPONSECURVE    291    /* $gray scale response curve */
  176. #define    TIFFTAG_GROUP3OPTIONS        292    /* 32 flag bits */
  177. #define        GROUP3OPT_2DENCODING    0x1    /* 2-dimensional coding */
  178. #define        GROUP3OPT_UNCOMPRESSED    0x2    /* data not compressed */
  179. #define        GROUP3OPT_FILLBITS        0x4    /* fill to byte boundary */
  180. #define    TIFFTAG_GROUP4OPTIONS        293    /* 32 flag bits */
  181. #define        GROUP4OPT_UNCOMPRESSED    0x2    /* data not compressed */
  182. #define    TIFFTAG_RESOLUTIONUNIT        296    /* units of resolutions */
  183. #define        RESUNIT_NONE        1    /* no meaningful units */
  184. #define        RESUNIT_INCH        2    /* english */
  185. #define        RESUNIT_CENTIMETER        3    /* metric */
  186. #define    TIFFTAG_PAGENUMBER        297    /* page numbers of multi-page */
  187. #define    TIFFTAG_COLORRESPONSEUNIT    300    /* $color curve accuracy */
  188. #define        COLORRESPONSEUNIT_10S    1    /* tenths of a unit */
  189. #define        COLORRESPONSEUNIT_100S    2    /* hundredths of a unit */
  190. #define        COLORRESPONSEUNIT_1000S    3    /* thousandths of a unit */
  191. #define        COLORRESPONSEUNIT_10000S    4    /* ten-thousandths of a unit */
  192. #define        COLORRESPONSEUNIT_100000S    5    /* hundred-thousandths */
  193. #define    TIFFTAG_TRANSFERFUNCTION    301    /* !colorimetry info */
  194. #define    TIFFTAG_SOFTWARE        305    /* name & release */
  195. #define    TIFFTAG_DATETIME        306    /* creation date and time */
  196. #define    TIFFTAG_ARTIST            315    /* creator of image */
  197. #define    TIFFTAG_HOSTCOMPUTER        316    /* machine where created */
  198. #define    TIFFTAG_PREDICTOR        317    /* prediction scheme w/ LZW */
  199. #define    TIFFTAG_WHITEPOINT        318    /* image white point */
  200. #define    TIFFTAG_PRIMARYCHROMATICITIES    319    /* !primary chromaticities */
  201. #define    TIFFTAG_COLORMAP        320    /* RGB map for pallette image */
  202. #define    TIFFTAG_HALFTONEHINTS        321    /* !highlight+shadow info */
  203. #define    TIFFTAG_TILEWIDTH        322    /* !rows/data tile */
  204. #define    TIFFTAG_TILELENGTH        323    /* !cols/data tile */
  205. #define TIFFTAG_TILEOFFSETS        324    /* !offsets to data tiles */
  206. #define TIFFTAG_TILEBYTECOUNTS        325    /* !byte counts for tiles */
  207. #define    TIFFTAG_BADFAXLINES        326    /* lines w/ wrong pixel count */
  208. #define    TIFFTAG_CLEANFAXDATA        327    /* regenerated line info */
  209. #define        CLEANFAXDATA_CLEAN        0    /* no errors detected */
  210. #define        CLEANFAXDATA_REGENERATED    1    /* receiver regenerated lines */
  211. #define        CLEANFAXDATA_UNCLEAN    2    /* uncorrected errors exist */
  212. #define    TIFFTAG_CONSECUTIVEBADFAXLINES    328    /* max consecutive bad lines */
  213. #define    TIFFTAG_INKSET            332    /* !inks in separated image */
  214. #define        INKSET_CMYK            1    /* !cyan-magenta-yellow-black */
  215. #define    TIFFTAG_INKNAMES        333    /* !ascii names of inks */
  216. #define    TIFFTAG_DOTRANGE        336    /* !0% and 100% dot codes */
  217. #define    TIFFTAG_TARGETPRINTER        337    /* !separation target */
  218. #define    TIFFTAG_EXTRASAMPLES        338    /* !info about extra samples */
  219. #define        EXTRASAMPLE_UNSPECIFIED    0    /* !unspecified data */
  220. #define        EXTRASAMPLE_ASSOCALPHA    1    /* !associated alpha data */
  221. #define        EXTRASAMPLE_UNASSALPHA    2    /* !unassociated alpha data */
  222. #define    TIFFTAG_SAMPLEFORMAT        339    /* !data sample format */
  223. #define        SAMPLEFORMAT_UINT        1    /* !unsigned integer data */
  224. #define        SAMPLEFORMAT_INT        2    /* !signed integer data */
  225. #define        SAMPLEFORMAT_IEEEFP        3    /* !IEEE floating point data */
  226. #define        SAMPLEFORMAT_VOID        4    /* !untyped data */
  227. #define    TIFFTAG_SMINSAMPLEVALUE        340    /* !variable MinSampleValue */
  228. #define    TIFFTAG_SMAXSAMPLEVALUE        341    /* !variable MaxSampleValue */
  229. #define    TIFFTAG_JPEGPROC        512    /* !JPEG processing algorithm */
  230. #define        JPEGPROC_BASELINE        1    /* !baseline sequential */
  231. #define        JPEGPROC_LOSSLESS        14    /* !Huffman coded lossless */
  232. #define    TIFFTAG_JPEGIFOFFSET        513    /* !pointer to SOI marker */
  233. #define    TIFFTAG_JPEGIFBYTECOUNT        514    /* !JFIF stream length */
  234. #define    TIFFTAG_JPEGRESTARTINTERVAL    515    /* !restart interval length */
  235. #define    TIFFTAG_JPEGLOSSLESSPREDICTORS    517    /* !lossless proc predictor */
  236. #define    TIFFTAG_JPEGPOINTTRANSFORM    518    /* !lossless point transform */
  237. #define    TIFFTAG_JPEGQTABLES        519    /* !Q matrice offsets */
  238. #define    TIFFTAG_JPEGDCTABLES        520    /* !DCT table offsets */
  239. #define    TIFFTAG_JPEGACTABLES        521    /* !AC coefficient offsets */
  240. #define    TIFFTAG_YCBCRCOEFFICIENTS    529    /* !RGB -> YCbCr transform */
  241. #define    TIFFTAG_YCBCRSUBSAMPLING    530    /* !YCbCr subsampling factors */
  242. #define    TIFFTAG_YCBCRPOSITIONING    531    /* !subsample positioning */
  243. #define        YCBCRPOSITION_CENTERED    1    /* !as in PostScript Level 2 */
  244. #define        YCBCRPOSITION_COSITED    2    /* !as in CCIR 601-1 */
  245. #define    TIFFTAG_REFERENCEBLACKWHITE    532    /* !colorimetry info */
  246. /* tags 32995-32999 are private tags registered to SGI */
  247. #define    TIFFTAG_MATTEING        32995    /* $use ExtraSamples */
  248. #define    TIFFTAG_DATATYPE        32996    /* $use SampleFormat */
  249. #define    TIFFTAG_IMAGEDEPTH        32997    /* z depth of image */
  250. #define    TIFFTAG_TILEDEPTH        32998    /* z depth/data tile */
  251. #endif /* _TIFF_ */
  252.